using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class VGUI_ContainerBase : MonoBehaviour
{
    public UISystem.UIInstance instance;
    public virtual void Init(object param = null) { }

    public void Close()
    {
        UISystem.UnRegis(this);
        Destroy(gameObject);
    }
    public void Start()
    {
        if (instance == null)
        {
            Init();
            instance = UISystem.Regis(this);
        }


    }

    private void OnDestroy()
    {

    }

    /// <summary>
    /// 有可能手动操作的节点
    /// </summary>
    public Transform[] maunalNodes = new Transform[] { };

    /// <summary>
    /// 数据绑定的节点
    /// </summary>
    public List<UIBindTarget> bindings;

    public bool RedirectBind(string oriDataName, string modifyDataName)
    {
        var bind = bindings.Find(x => x.dataName == oriDataName);
        if (bind != null)
        {
            bind.dataName = modifyDataName;
            return true;
        }
        return false;
    }
}
